import React, { Component } from 'react'

export default class index extends Component {
  render() {
    return (
      <div>
        <div>我是最外层</div>
        <A render={(name) => <B name={name} />} />
      </div>
    )
  }
}

class A extends Component {
  state = {name: "组件A的状态"}
  render() {
    return (
      <div>
        我是组件A
        {this.props.render(this.state.name)}
      </div>
    )
  }
}


class B extends Component {
  render() {
    return (
      <div>
        <div>我是组件B</div>
        <div>这是A组件给我传入的值:{this.props.name}</div>
      </div>
    )
  }
}



